package com.yc.sole.erp.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.yc.sole.erp.enums.PriorityType;
import com.yc.sole.erp.enums.ProduceSourceType;
import com.yc.sole.erp.enums.ProduceState;
import com.yc.sole.framework.mybatis.entity.BaseEntity;
import jakarta.persistence.*;
import lombok.Data;

/**
 * 生产表
 *
 * @author yizuomin
 * @date 2024/1/13 13:24
 **/
@Data
@Entity
@Table(name = "erp_produce")
@TableName(value = "erp_produce", autoResultMap = true)
public class Produce extends BaseEntity {

    /**
     * id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 生产编号
     */
    @Column(columnDefinition = "VARCHAR(32) NOT NULL COMMENT '生产编号'", unique = true)
    private String produceNo;
    /**
     * 生产日期
     */
    @Column(columnDefinition = "VARCHAR(20) NOT NULL COMMENT '生产日期'")
    private String produceDate;
    /**
     * 销售订单表id
     */
    @Column(columnDefinition = "BIGINT COMMENT '销售订单表id'")
    private Long orderId;
    /**
     * 销售订单编号
     */
    @Column(columnDefinition = "VARCHAR(32) COMMENT '销售订单编号'")
    private String orderNo;
    /**
     * 产品id
     */
    @Column(columnDefinition = "BIGINT NOT NULL COMMENT '产品id'")
    private Long productId;
    /**
     * 产品名称
     */
    @Column(columnDefinition = "VARCHAR(50) NOT NULL COMMENT '产品id'")
    private String productName;
    /**
     * 客户id  0为库存备货
     */
    @Column(columnDefinition = "BIGINT NOT NULL DEFAULT 0 COMMENT '客户id'")
    private Long customerId;
    /**
     * 客户名称
     */
    @Column(columnDefinition = "VARCHAR(50) NOT NULL COMMENT '客户名称'")
    private String customerName;
    /**
     * 总数量
     */
    @Column(columnDefinition = "INT UNSIGNED NOT NULL COMMENT '数量'")
    private Integer quantity;
    /**
     * 剩余数量
     */
    @Column(columnDefinition = "INT UNSIGNED NOT NULL COMMENT '剩余数量'")
    private Integer remainingQuantity;
    /**
     * 优先级 0普通 1加急
     */
    @Column(columnDefinition = "TINYINT NOT NULL COMMENT '优先级'")
    private PriorityType priority;
    /**
     * 生产状态 0生产中 1暂停 2已完成 3取消
     */
    @Column(columnDefinition = "TINYINT NOT NULL COMMENT '生产状态'")
    private ProduceState produceState;
    /**
     * 来源 0销售订单 1库存备货
     */
    @Column(columnDefinition = "TINYINT NOT NULL COMMENT '来源'")
    private ProduceSourceType sourceType;
    /**
     * 结束生产日期
     */
    @Column(columnDefinition = "VARCHAR(20) COMMENT '结束生产日期'")
    @TableField(updateStrategy = FieldStrategy.ALWAYS)
    private String produceEndDate;
    /**
     * 备注
     */
    @Column(columnDefinition = "VARCHAR(255) COMMENT '备注'")
    private String remark;
    /**
     * 是否删除
     */
    @TableLogic
    @Column(columnDefinition = "INT NOT NULL DEFAULT 0 COMMENT '是否已删除'")
    private Integer deleted;
}
